package scauCmiScaffolding.compiled;

import org.eclipse.jet.JET2Context;
import org.eclipse.jet.JET2Template;
import org.eclipse.jet.JET2Writer;
import org.eclipse.jet.taglib.RuntimeTagElement;
import org.eclipse.jet.taglib.TagInfo;

public class _jet_cmisqlUtil implements JET2Template {
    private static final String _jetns_c = "org.eclipse.jet.controlTags"; //$NON-NLS-1$
    private static final String _jetns_java = "org.eclipse.jet.javaTags"; //$NON-NLS-1$

    public _jet_cmisqlUtil() {
        super();
    }

    private static final String NL = System.getProperty("line.separator"); //$NON-NLS-1$
    
    private static final TagInfo _td_c_get_1_9 = new TagInfo("c:get", //$NON-NLS-1$
            1, 9,
            new String[] {
                "select", //$NON-NLS-1$
            },
            new String[] {
                "$packageName", //$NON-NLS-1$
            } );
    private static final TagInfo _td_c_get_9_8 = new TagInfo("c:get", //$NON-NLS-1$
            9, 8,
            new String[] {
                "select", //$NON-NLS-1$
            },
            new String[] {
                "$packageName", //$NON-NLS-1$
            } );
    private static final TagInfo _td_java_format_11_1 = new TagInfo("java:format", //$NON-NLS-1$
            11, 1,
            new String[] {
            },
            new String[] {
            } );

    public void generate(final JET2Context context, final JET2Writer __out) {
        JET2Writer out = __out;
        out.write("package ");  //$NON-NLS-1$        
        RuntimeTagElement _jettag_c_get_1_9 = context.getTagFactory().createRuntimeTag(_jetns_c, "get", "c:get", _td_c_get_1_9); //$NON-NLS-1$ //$NON-NLS-2$
        _jettag_c_get_1_9.setRuntimeParent(null);
        _jettag_c_get_1_9.setTagInfo(_td_c_get_1_9);
        _jettag_c_get_1_9.doStart(context, out);
        _jettag_c_get_1_9.doEnd();
        out.write(".util;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write(NL);         
        out.write("import java.util.Iterator;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("import java.util.List;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("import java.util.HashMap;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("import java.util.Map;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("import java.util.Set;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("import org.springframework.transaction.annotation.Transactional;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("import ");  //$NON-NLS-1$        
        RuntimeTagElement _jettag_c_get_9_8 = context.getTagFactory().createRuntimeTag(_jetns_c, "get", "c:get", _td_c_get_9_8); //$NON-NLS-1$ //$NON-NLS-2$
        _jettag_c_get_9_8.setRuntimeParent(null);
        _jettag_c_get_9_8.setTagInfo(_td_c_get_9_8);
        _jettag_c_get_9_8.doStart(context, out);
        _jettag_c_get_9_8.doEnd();
        out.write(".base.bean.CmiPagination;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write(NL);         
        RuntimeTagElement _jettag_java_format_11_1 = context.getTagFactory().createRuntimeTag(_jetns_java, "format", "java:format", _td_java_format_11_1); //$NON-NLS-1$ //$NON-NLS-2$
        _jettag_java_format_11_1.setRuntimeParent(null);
        _jettag_java_format_11_1.setTagInfo(_td_java_format_11_1);
        _jettag_java_format_11_1.doStart(context, out);
        JET2Writer _jettag_java_format_11_1_saved_out = out;
        while (_jettag_java_format_11_1.okToProcessBody()) {
            out = out.newNestedContentWriter();
            out.write(NL);         
            out.write(NL);         
            out.write("public class CmiSqlUtil {");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t@Transactional");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\tpublic  static String  createEntityCountSqlStatement(CmiPagination  page,Class entity) {");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\tString entityName = entity.getName();");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\tStringBuilder  sqlStringBuilder = new StringBuilder();");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\tsqlStringBuilder.append(\"select count(myEntity) from \" + entityName  + \" myEntity\");");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\tString addSQL = linkConditionForSQL(page,entity);");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\tsqlStringBuilder = sqlStringBuilder.append(addSQL);");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\treturn sqlStringBuilder.toString();");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t}");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t@Transactional");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\tpublic  static String  createEntityCountNativeSqlStatement(CmiPagination  page) {");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\tStringBuilder  sqlStringBuilder = new StringBuilder();");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\tsqlStringBuilder.append(\"select count(*\\r\\n\" + ");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\t\t\") from featurestandard join standard on featurestandard.standard=standard.id join feature on  featurestandard.feature=feature.id join unit on featurestandard.unit=unit.id join standardlevel on standard.standardlevel=standardlevel.id join standardtype on standard.standardtype=standardtype.id\");");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\tString addSQL = linkConditionForNativeSQL(page);");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\tsqlStringBuilder = sqlStringBuilder.append(addSQL);");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\treturn sqlStringBuilder.toString();");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t}");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t@Transactional");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\tpublic  static String  createSelectEntityNativeSqlStatement(CmiPagination  page) {");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\tStringBuilder  sqlStringBuilder = new StringBuilder();");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\tsqlStringBuilder.append(\"select standard.name as s_name,standardlevel.name as sl_name,standardtype.name as st_name ,standard.effectivedate,standard.expirydate,feature.name as f_name ,unit.name as u_name ,featurestandard.min,featurestandard.max from featurestandard join standard on featurestandard.standard=standard.id join feature on  featurestandard.feature=feature.id join unit on featurestandard.unit=unit.id join standardlevel on standard.standardlevel=standardlevel.id join\\r\\n\" + ");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\t\t\" standardtype on standard.standardtype=standardtype.id \");");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\tString addSQL = linkConditionForNativeSQL(page);");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\tsqlStringBuilder = sqlStringBuilder.append(addSQL);");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\tSystem.out.println(\"NativeSql:-->>\"+addSQL);");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\treturn sqlStringBuilder.toString();");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t}");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t@Transactional");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\tpublic static String  createSelectEntitySqlStatement(CmiPagination  page,Class entity) {");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\tString entityName = entity.getName();");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\tStringBuilder  sqlStringBuilder = new StringBuilder();");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\tsqlStringBuilder.append(\"select myEntity from \" + entityName  + \" myEntity\");");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\tString addSQL = linkConditionForSQL(page,entity);");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\tsqlStringBuilder = sqlStringBuilder.append(addSQL);");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\treturn sqlStringBuilder.toString();");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t}");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t@Transactional");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\tpublic static String  createSelectEntitySqlStatementInRange(CmiPagination  page,Class entity) {");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\tString entityName = entity.getName();");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\tStringBuilder  sqlStringBuilder = new StringBuilder();");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\tsqlStringBuilder.append(\"select myEntity from \" + entityName  + \" myEntity\");");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\tString addSQL = linkConditionInRange(page,entity);");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\tsqlStringBuilder = sqlStringBuilder.append(addSQL);");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\treturn sqlStringBuilder.toString();");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t}");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t@Transactional");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\tpublic static String linkConditionForSQL(CmiPagination  page,Class entity) {");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\tStringBuilder  sqlStringBuilder = new StringBuilder();");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\tList<String>  combinedSelectConditions = page.getCombinedSelectConditions();");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\tList<String>  combinedConditions = page.getCombinedConditions();");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\tIterator<String> combinedSelectConditionsIterator = combinedSelectConditions.iterator();");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\tIterator<String> combinedConditionsIterator = combinedConditions.iterator();");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\tString selectCondition;");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\tString condition;");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\twhile(combinedConditionsIterator.hasNext()) {");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\tselectCondition = combinedSelectConditionsIterator.next();");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\tselectCondition = selectCondition.substring(0, 1).toLowerCase() + selectCondition.substring(1);");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\tcondition  = \tcombinedConditionsIterator.next().trim();");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\tif(condition.equals(\"\"))  continue;");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\t");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\t//鍒ゆ柇鏄笉鏄渶鍚庝竴涓紝鐒跺悗娣诲姞鍒ゆ柇鏉′欢");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\tif(sqlStringBuilder.length() > 0) {");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\t\tsqlStringBuilder.append(\" and\");");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\t}");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\t");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\t//SQL璇彞鍒涘缓");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\tsqlStringBuilder.append(\" myEntity.\" + selectCondition);");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\t//System.out.println(sqlStringBuilder.toString());");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\ttry {");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("//\t\t\t\t濡傛灉鏄疭tring绫诲瀷锛屼娇鐢ㄦā绯婃煡宸★紝濡傛灉鏄叾浠栫被鍨嬶紝灏变娇鐢ㄧ簿纭煡璇€��");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\t\tif(entity.getDeclaredField(selectCondition).getType().getName().equals(\"java.lang.String\")) {");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\t\t\tsqlStringBuilder.append(\" like \\'%\" + condition + \"%\\'\");");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\t\t}else {");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\t\t\tsqlStringBuilder.append(\" = \" + \"\\'\" + condition + \"\\'\");");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\t\t}");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\t} catch (NoSuchFieldException e) {");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\t\t// TODO Auto-generated catch block");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\t\te.printStackTrace();");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\t} catch (SecurityException e) {");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\t\t// TODO Auto-generated catch block");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\t\te.printStackTrace();   ");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\t}");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t}");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\tif(sqlStringBuilder.length() > 0) {");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\tsqlStringBuilder.insert(0,\" where\");");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\treturn sqlStringBuilder.toString();");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t}else {");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\treturn \"\";");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t}");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t}");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t@Transactional");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\tpublic static String linkConditionForNativeSQL(CmiPagination  page) {");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\tMap<String, String> conditionMap = new HashMap<>();");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\tconditionMap.put(\"standardName\", \" standard.name \");");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\tconditionMap.put(\"standardLevel\", \" standardlevel.name \");");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\tconditionMap.put(\"standardType\", \" standardtype.name \");");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\tconditionMap.put(\"featureName\", \" feature.name \");");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\tStringBuilder  sqlStringBuilder = new StringBuilder();");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\tList<String>  combinedSelectConditions = page.getCombinedSelectConditions();");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\tList<String>  combinedConditions = page.getCombinedConditions();");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\tIterator<String> combinedSelectConditionsIterator = combinedSelectConditions.iterator();");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\tIterator<String> combinedConditionsIterator = combinedConditions.iterator();");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\tString selectCondition;");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\tString condition;");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\twhile(combinedConditionsIterator.hasNext()) {");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\tselectCondition = combinedSelectConditionsIterator.next();");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\tselectCondition = selectCondition.substring(0, 1).toLowerCase() + selectCondition.substring(1);");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\tcondition  = \tcombinedConditionsIterator.next().trim();");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\tif(condition.equals(\"\"))  continue;");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\t");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\t//鍒ゆ柇鏄笉鏄渶鍚庝竴涓紝鐒跺悗娣诲姞鍒ゆ柇鏉′欢");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\tif(sqlStringBuilder.length() > 0) {");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\t\tsqlStringBuilder.append(\" and\");");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\t}");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\tSystem.out.println(\"selectCondition:-->>\"+selectCondition);");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\t//SQL璇彞鍒涘缓");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\tsqlStringBuilder.append(conditionMap.get(selectCondition));");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\t//System.out.println(sqlStringBuilder.toString());");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\tsqlStringBuilder.append(\" like \\'%\" + condition + \"%\\'\");");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t}");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\tif(sqlStringBuilder.length() > 0 && !sqlStringBuilder.toString().contains(\"where\")) {");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\tsqlStringBuilder.insert(0,\" where\");");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\treturn sqlStringBuilder.toString();");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t}else {");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\treturn \"\";");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t}");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t}");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t@Transactional");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\tpublic static String linkConditionInRange(CmiPagination  page,Class entity) {");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\tStringBuilder  sqlStringBuilder = new StringBuilder();");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\tStringBuilder  rangeBuilder = new StringBuilder();");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\tList<String>  combinedSelectConditions = page.getCombinedSelectConditions();");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\tList<String>  combinedConditions = page.getCombinedConditions();");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\tSet<Integer> rangeConditions = page.getEventIds();");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\tIterator<String> combinedSelectConditionsIterator = combinedSelectConditions.iterator();");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\tIterator<String> combinedConditionsIterator = combinedConditions.iterator();");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\tIterator<Integer> rangeConditionsIterator = rangeConditions.iterator();");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\tString selectCondition;");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\tString condition;");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\tString range;");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\twhile(rangeConditionsIterator.hasNext()) {");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\tif(rangeBuilder.length()==0) {");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\t\trangeBuilder.append(\"(\");");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\t}");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\trange = rangeConditionsIterator.next().toString();");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\trangeBuilder.append(range+\",\");");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t}");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\tif(rangeBuilder.length()>0) {");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\trangeBuilder.deleteCharAt(rangeBuilder.lastIndexOf(\",\"));");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\trangeBuilder.append(\")\");");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t}");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\twhile(combinedConditionsIterator.hasNext()) {");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\tselectCondition = combinedSelectConditionsIterator.next();");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\tselectCondition = selectCondition.substring(0, 1).toLowerCase() + selectCondition.substring(1);");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\tcondition  = \tcombinedConditionsIterator.next().trim();");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\tif(condition.equals(\"\"))  continue;");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\t");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\t//鍒ゆ柇鏄笉鏄渶鍚庝竴涓紝鐒跺悗娣诲姞鍒ゆ柇鏉′欢");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\tif(rangeBuilder.length() > 0) {");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\t\tsqlStringBuilder.append(\" and\");");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\t}");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\t//sqlStringBuilder.append(\" and\");");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\t");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\t//SQL璇彞鍒涘缓");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\tsqlStringBuilder.append(\" myEntity.\" + selectCondition);");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\t//System.out.println(sqlStringBuilder.toString());");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\ttry {");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("//\t\t\t\t濡傛灉鏄疭tring绫诲瀷锛屼娇鐢ㄦā绯婃煡宸★紝濡傛灉鏄叾浠栫被鍨嬶紝灏变娇鐢ㄧ簿纭煡璇€��");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\t\tif(entity.getDeclaredField(selectCondition).getType().getName().equals(\"java.lang.String\")) {");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\t\t\tsqlStringBuilder.append(\" like \\'%\" + condition + \"%\\'\");");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\t\t}else {");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\t\t\tsqlStringBuilder.append(\" = \" + \"\\'\" + condition + \"\\'\");");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\t\t}");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\t} catch (NoSuchFieldException e) {");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\t\t// TODO Auto-generated catch block");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\t\te.printStackTrace();");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\t} catch (SecurityException e) {");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\t\t// TODO Auto-generated catch block");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\t\te.printStackTrace();   ");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\t}");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t}");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\tif(rangeBuilder.length() > 0) {");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\tsqlStringBuilder.insert(0,\" where \"+\"myEntity.id in \"+ rangeBuilder.toString());");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\tSystem.out.println(\"001\"+sqlStringBuilder.toString());");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\treturn sqlStringBuilder.toString();");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t}else if(sqlStringBuilder.length()>0) {");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\tsqlStringBuilder.insert(0,\" where \");");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\tSystem.out.println(\"002\"+sqlStringBuilder.toString());");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\treturn sqlStringBuilder.toString();");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t}");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\telse {");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\tSystem.out.println(\"003\");");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\treturn \"\";");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t}");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("//\t\t\tsqlStringBuilder.insert(0,\" where \"+);");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("//\t\t\treturn sqlStringBuilder.toString();");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t}");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\tpublic static String linkSqlWithStringList(List<String> featureNames,List<String> unitNames) {");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\tString sql = \"( ( feature.name = '\"+featureNames.get(0)+\" \"+\"' and unit.name = '\"+unitNames.get(0)+\"' )\";");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\tfor(int i=1;i<featureNames.size();i++) {");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t\tsql+=\" or ( feature.name = '\"+featureNames.get(i)+\" \"+\"' and unit.name = '\"+unitNames.get(i)+\"' )\";");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\t}");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\tsql+=\" )\";");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\tSystem.out.println(\"linkSqlWithStringList:-->>\"+sql);");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t\treturn sql;");  //$NON-NLS-1$        
            out.write(NL);         
            out.write("\t}");  //$NON-NLS-1$        
            out.write(NL);         
            out.write(NL);         
            out.write("}");  //$NON-NLS-1$        
            out.write(NL);         
            _jettag_java_format_11_1.handleBodyContent(out);
        }
        out = _jettag_java_format_11_1_saved_out;
        _jettag_java_format_11_1.doEnd();
    }
}
